package com.liu.HomeWork;

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;

/**
 * 客户端
 */
public class HomeWork01Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket(InetAddress.getLocalHost(),6666);
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String[] strings = {"name","hobby"};
        for (int i = 0; i < strings.length; i++) {
            bufferedWriter.write(strings[i]);
            bufferedWriter.newLine();
            bufferedWriter.flush();
            String s = bufferedReader.readLine();
            System.out.println(s);
        }
        socket.close();
        bufferedWriter.close();
        bufferedReader.close();
    }
}
